{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"Represent a volume as lego blocks (voxels). Colors correspond to the volume's scalar.\"\"\"\n",
    "\n",
    "# https://matplotlib.org/users/colormaps.html\n",
    "from vedo import *\n",
    "\n",
    "vol = load(datadir+'embryo.tif') # load Volume\n",
    "printHistogram(vol, logscale=True)\n",
    "\n",
    "vol.crop(back=0.5) # crop 50% from neg. y\n",
    "\n",
    "# show lego blocks whose value is between vmin and vmax\n",
    "lego = vol.legosurface(vmin=60, cmap='seismic')\n",
    "\n",
    "lego.addScalarBar(horizontal=1) # make colormap start at 40\n",
    "\n",
    "show(lego, viewup='z')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
